import {NestFactory} from '@nestjs/core';
import {AppModule} from './app.module';
import {setupSwagger} from "./utils/setup-swagger";
// import {Cors} from "@nestjs/common"
// import { MyLogger } from "./modules/common/logger/myLogger";

const port = 8787

async function bootstrap() {
    const app = await NestFactory.create(AppModule, {
        bufferLogs: true
    });

    /* 日志 */
    // app.useLogger(app.get(MyLogger))

    /* 启动跨域 */
    app.enableCors()

    /* 启动swagger */
    setupSwagger(app)

    await app.listen(port);
}

bootstrap().then(() => {
    console.log(`Swagger: http://localhost:${port}/doc.html`);
});
